# --------------------------------------------------
# -*- coding: utf-8 -*-
# Time: 2023/2/13 11:05
# Author: 沈凌鹏
# Version: 0.1
# File: item_factory.py
# Description: 简单工厂结构，存放分发英雄道具
# --------------------------------------------------

# 用于接收用户输入
class Operation():
    # 初始化四项属性
    def __init__(self, hp=1, power=1, speed=1, defences=13):
        self.hp = hp
        self.power = power
        self.speed = speed
        self.defences = defences

    def item(self):
        pass


# 体力道具,选择后修改体力
class HpItemOp(Operation):
    def item(self):
        return self.hp * 1.5


# 力量道具,选择后修改力量
class PowerItemOp(Operation):
    def item(self):
        return self.power * 1.1


# 速度道具,选择后修改速度
class SpeedItemOp(Operation):
    def item(self):
        return self.speed * 1.5


# 防御道具,选择后修改防御
class DefencesItemOp(Operation):
    def item(self):
        return self.speed * 1.5


# 工厂类,确定选择到道具
class OperationFactory():
    def ChooseOperation(self, itemNum):
        if itemNum == "1":
            return HpItemOp()
        if itemNum == "2":
            return PowerItemOp()
        if itemNum == "3":
            return SpeedItemOp()
        if itemNum == "4":
            return DefencesItemOp()
